package com.hznu.stmanage.serviceImpl;

import com.hznu.stmanage.dao.WeeklyMapper;
import com.hznu.stmanage.entity.Weekly;
import com.hznu.stmanage.service.BaseService;
import com.hznu.stmanage.service.WeeklyService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by J_Vino on 16/3/6.
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class WeeklyServiceImpl extends BaseService implements WeeklyService {

    WeeklyMapper weeklyMapper = null;
    public void setMapper()
    {
        if(weeklyMapper==null)
            weeklyMapper = getWeeklyMapper();//1.获取相关mapper
    }
    public int deleteByPrimaryKey(Long id) {
        setMapper();
        return weeklyMapper.deleteByPrimaryKey(id);
    }

    public int insert(Weekly record) {
        setMapper();
        return weeklyMapper.insert(record);
    }

    public int insertSelective(Weekly record) {
        setMapper();
        return weeklyMapper.insertSelective(record);
    }

    public Weekly selectByPrimaryKey(Long id) {
        setMapper();
        return weeklyMapper.selectByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(Weekly record) {
        setMapper();
        return weeklyMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(Weekly record) {
        setMapper();
        return weeklyMapper.updateByPrimaryKey(record);
    }
}
